package com.winderinfo.yikaotianxia.ui.jiaocai;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.winderinfo.yikaotianxia.ui.banxing.BanXinListFragment;
import com.winderinfo.yikaotianxia.ui.home.ZhuanYeBean;

import java.util.List;

public class JiaoCaiPagerAdapter extends FragmentPagerAdapter {

    private List<ZhuanYeBean.RowsBean> mTableList;

    public JiaoCaiPagerAdapter(FragmentManager fm, List<ZhuanYeBean.RowsBean> mTableList) {
        super(fm);
        this.mTableList = mTableList;
    }


    @Override
    public Fragment getItem(int i) {
        JiaoCaiListFragment jiaoCaiListFragment = new JiaoCaiListFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("position", mTableList.get(i).getId());
        jiaoCaiListFragment.setArguments(bundle);
        return jiaoCaiListFragment;
    }

    @Override
    public int getCount() {
        return mTableList.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mTableList.get(position).getName();
    }
}
